<?php

declare(strict_types=1);

namespace App\Model\PssModel;

use App\Model\BaseModel\BasePssModel;

class Template extends BasePssModel
{
    public $table = 'template';
    const TYPE_DEFAULT  = 1;
    const TYPE_RATE     = 2;
    const TYPE_PRICE    = 3;
    const TYPE_CLASS    = 4;
    const DEFAULT_TPL_ID = 1;
    
    //指定写入字段
    protected $fillable = [
        
    ];
    
    //指定字段展示类型
    protected $casts = [
        
    ];
    
    /**
     * 获取模板价格详情
     * @param number $template_id
     */
    public function getTemplateInfoById( $template_id = self::DEFAULT_TPL_ID )
    {
        return $this->info([
            'id' => $template_id,
        ],[
            'tpl_type',
            'tpl_contents',
            'user_type',
            'user_level'
        ]);
    }
    
    /**
     * 获取模板价格详情
     * @param number $userLevel
     */
    public function getTemplateInfoByUserLevel( $userLevel = 0 )
    {
        return $this->info([
            'user_type'     => 1,
            'user_level'    => $userLevel,
        ],[
            'tpl_type',
            'tpl_contents',
            'user_type',
            'user_level'
        ]);
    }
}